package com.mxpio.erp.common.quality.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.model.Order;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * @Author : wpp
 * @Datetime : 2023/6/6 14:32
 * @Desc :
 * @Modor :  Modifytime:
 * @modDesc : 不良品处理单
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_QUALITY_UD")
@Schema(description="不良品处理单")
public class UnqualifiedDisposal extends Order {

    private static final long serialVersionUID = 1L;


    @Column(name = "APPLY_REASON_")
    @Schema(description = "申请事由")
    private String applyReason;

    @Column(name = "ATCH_FILE_NO_")
    @Schema(description = "申请附件")
    private String atchFileNo;


    @Column(name = "TECH_OPINION_")
    @Schema(description = "技术审核意见")
    @Dict(dicCode = "ERP_QUAL_AUDIT_OPINION")
    private String techOpinion;

    @Column(name = "TECH_OPINION_DESC_")
    @Schema(description = "技术意见说明")
    private String techOpinionDesc;

    @Column(name = "TECH_REVIEWER_")
    @Schema(description = "技术审核人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String techReviewer;

    @Column(name = "TECH_REVIEW_TIME_")
    @Schema(description = "技术审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date techReviewTime;



    @Column(name = "CRAFT_OPINION_")
    @Schema(description = "工艺审核意见")
    @Dict(dicCode = "ERP_QUAL_AUDIT_OPINION")
    private String craftOpinion;

    @Column(name = "CRAFT_OPINION_DESC_")
    @Schema(description = "工艺意见说明")
    private String craftOpinionDesc;

    @Column(name = "CRAFT_REVIEWER_")
    @Schema(description = "工艺审核人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String craftReviewer;

    @Column(name = "CRAFT_REVIEW_TIME_")
    @Schema(description = "工艺审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date craftReviewTime;


    @Column(name = "QUALITY_OPINION_")
    @Schema(description = "质检审核意见")
    @Dict(dicCode = "ERP_QUAL_AUDIT_OPINION")
    private String qualityOpinion;

    @Column(name = "QUALITY_OPINION_DESC_")
    @Schema(description = "质检意见说明")
    private String qualityOpinionDesc;

    @Column(name = "QUALITY_REVIEWER_")
    @Schema(description = "质检审核人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String qualityReviewer;

    @Column(name = "QUALITY_REVIEW_TIME_")
    @Schema(description = "质检审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date qualityReviewTime;

    @Transient
    private List<UnqualifiedDisposalLine> unqualifiedDisposalLines;
    @Override
    public String initTypeCode() {
        return "UD1";
    }
}
